using System.Reflection;
using Microsoft.SharePoint.Administration;

namespace DP.Sharepoint.Workflow.Install
{
    public class SPDActivityReciever : WebConfigModifier
    {
        protected override string OwnerModif
        {
            get { return "DP.Install"; }
        }

        protected override void AddConfigurationToWebConfig(SPWebApplication app)
        {
            string assemblyName = Assembly.GetExecutingAssembly().GetName().FullName;

            AddNodeValue(string.Format("authorizedType[@Assembly='{0}']", assemblyName),
                              "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes",
                              string.Format(
                                  @"<authorizedType Assembly=""{0}"" Namespace=""DP.Sharepoint.Workflow"" TypeName=""*"" Authorized=""True"" />",
                                  assemblyName));

            SaveWebConfig(app);
        }
    }
}